package com.test.pattern.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: StudentAggregateImpl
 * @description:
 * @author: Mr du
 * @create: 2024-03-17 18:02
 */
public class StudentAggregateImpl implements StudentAggregate{

    private List<Student> list = new ArrayList<>();

    @Override
    public void addStudent(Student student) {
        list.add(student);
    }

    @Override
    public void removeStudent(Student student) {
        list.remove(student);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(list);
    }
}
